<%@ include file="/taglibs.jsp"%>
<jsp:directive.page import="java.util.Random"/>
<jsp:directive.page import="java.util.Date"/>
<jsp:directive.page import="com.winterwar.base.Convention"/>
<title>Winter War - Full Event Listing</title>
<script type="text/javascript" language="javascript">
$(document).ready(function() {
    $("input[type='checkbox']").click(
    	    function() {
        	    var allEmptySlots = true;
        	    var allEmptyTypes = true;
    	    	<c:forEach var="slot" items="${slots}">
    	        	if($("#slot_${slot.slotID}").attr("checked")){
    	        		allEmptySlots=false;
        	        	$("#${slot.slotID}").show();
    	        	} else {
       	        	    $("#${slot.slotID}").hide();
    	        	}
    	    	</c:forEach>
    	    	if($("#card").attr("checked")) {
        	        $("table[name='card']").show();
        	        $("h3[name='card']").show();
        	        allEmptyTypes = false;
    	    	} else {
        	        $("table[name='card']").hide();
        	        $("h3[name='card']").hide();
    	    	}
    	    	if($("#mini").attr("checked")) {
        	        $("table[name='mini']").show();
        	        $("h3[name='mini']").show();
        	        allEmptyTypes = false;
    	    	} else {
        	        $("table[name='mini']").hide();
        	        $("h3[name='mini']").hide();
    	    	}
    	    	if($("#rpg").attr("checked")) {
        	        $("table[name='rpg']").show();
        	        $("h3[name='rpg']").show();
        	        allEmptyTypes = false;
    	    	} else {
        	        $("table[name='rpg']").hide();
        	        $("h3[name='rpg']").hide();
    	    	}
    	    	if($("#board").attr("checked")) {
        	        $("table[name='board']").show();
        	        $("h3[name='board']").show();
        	        allEmptyTypes = false;
    	    	} else {
        	        $("table[name='board']").hide();
        	        $("h3[name='board']").hide();
    	    	}
    	    	if(allEmptySlots){
        	    	<c:forEach var="slot" items="${slots}">
        	        	 $("#${slot.slotID}").show();
    	    		</c:forEach>
    	    	}
    	    	if(allEmptyTypes){
        	        $("table[name='card']").show();
        	        $("h3[name='card']").show();
        	        
        	        $("table[name='board']").show();
        	        $("h3[name='board']").show();
        	        
        	        $("table[name='rpg']").show();
        	        $("h3[name='rpg']").show();
        	        
        	        $("table[name='mini']").show();
        	        $("h3[name='mini']").show();
    	    	}
        	    	
    	    });
});

</script>
<h2>Full Event Listing For ${conName }</h2>
To filter your view, check the boxes below to show only events of those types or time slot.
<center>
<br/>List Events by Convention:<br/>
<select name="con" id="con" onChange="location = '/events/' + this.value">
	<c:forEach var="con" items="${cons }">
		<c:choose>
		<c:when test="${conID == con.conID }">
		<option value="${con.conID }" selected="true">${con.conName } <c:if test="${con.current == true }">(Current)</c:if></option>
		</c:when>
		<c:otherwise>
		<option value="${con.conID }">${con.conName } <c:if test="${con.current == true }">(Current)</c:if></option>
		</c:otherwise>
		</c:choose>
	</c:forEach>
</select>
<table cellspacing="4" style="text-align:left" width="85%">
	<thead>
		<tr>
			<th width="75%">Time Slot</th>
			<th>Game Type</th>
		</tr>
	</thead>
	<tr>
		<td style="display:inline">
			<span style="display:inline;float:left;">
			<c:set var="count" value="0" />
			<c:forEach var="slot" items="${slots}">
				<c:choose>
					<c:when test="${count % 3 == 0 && count > 0}">
					</span><span style="display:inline;float:left">
					</c:when>
				</c:choose>
				<input type="checkbox" id="slot_${slot.slotID }"/>${slot.slotName }<br/>
				<c:set var="count" value="${count+1 }"/>
			</c:forEach>
			</span>
		</td>
		<td style="vertical-align:top">
			<input type="checkbox" id="board"/>Board Games<br/>
			<input type="checkbox" id="card"/>Card Games<br/>
			<input type="checkbox" id="rpg"/>Role Playing Games<br/>
			<input type="checkbox" id="mini"/>Miniatures Games<br/>
		</td>
	</tr>
</table>
</center>
<c:forEach var="slot" items="${slots}">
	<div id="${slot.slotID}" style="width:100%"><div class="slotHeader" >&nbsp;&nbsp;Session ${slot.slotName} ${slot.startDateHour } ${slot.startDateAMPM } - ${ slot.endDateHour} ${slot.endDateAMPM }</div>
	<h3 name="board">Board Game Events</h3>
	<table width="100%" name="board">
		<thead>
			<th width="20%">Event Name</th>
			<th width="65%">Description</th>
			<th width="15%">Details</th>
		</thead>
		<tbody>
	<c:forEach var="event" items="${slot.events }">
		<c:choose>
			<c:when test="${event.status == 3 && event.eventType == 1}">
				<tr>
					<td style="border-bottom:1px solid #C0C0C0;">${event.eventName }</td>
					<td style="border-bottom:1px solid #C0C0C0;">${event.eventDesc }</td>
					<td style="border-bottom:1px solid #C0C0C0;font-size:10pt">
						${event.rules }<br>
						<c:choose>
							<c:when test="${event.playerExperience == 1 }">Younger Players Welcome</c:when>
							<c:when test="${event.playerExperience == 2 }">Newcomers Welcome</c:when>
							<c:when test="${event.playerExperience == 3 }">Some Gaming Experience</c:when>
							<c:when test="${event.playerExperience == 4 }">Some Experience with Specific Game</c:when>
							<c:when test="${event.playerExperience == 5 }">Regular Play of Specific Game</c:when>
							<c:when test="${event.playerExperience == 6 }">High Degree of Experience</c:when>
						</c:choose><br>
						${event.totalSeats } Players<br>
						${event.user.firstName } ${event.user.lastName }
					<c:choose>
						<c:when test="${event.additionalJudges != null && event.additionalJudges != ''}">
							&nbsp;And ${event.additionalJudges }
						</c:when>
					</c:choose> 
					</td>
				</tr>
			</c:when>
		</c:choose>
		</tr>
	</c:forEach>
		</tbody>
	</table>

	<h3 name="card">Card Game Events</h3>
	<table width="100%" name="card">
		<thead>
			<th width="20%">Event Name</th>
			<th width="65%">Description</th>
			<th width="15%">Details</th>
		</thead>
		<tbody>
	<c:forEach var="event" items="${slot.events }">
		<c:choose>
			<c:when test="${event.status == 3 && event.eventType == 2}">
				<tr>
					<td style="border-bottom:1px solid #C0C0C0;">${event.eventName }</td>
					<td style="border-bottom:1px solid #C0C0C0;">${event.eventDesc }</td>
					<td style="border-bottom:1px solid #C0C0C0;font-size:10pt">
						${event.rules }<br>
						<c:choose>
							<c:when test="${event.playerExperience == 1 }">Younger Players Welcome</c:when>
							<c:when test="${event.playerExperience == 2 }">Newcomers Welcome</c:when>
							<c:when test="${event.playerExperience == 3 }">Some Gaming Experience</c:when>
							<c:when test="${event.playerExperience == 4 }">Some Experience with Specific Game</c:when>
							<c:when test="${event.playerExperience == 5 }">Regular Play of Specific Game</c:when>
							<c:when test="${event.playerExperience == 6 }">High Degree of Experience</c:when>
						</c:choose><br>
						${event.totalSeats } Players<br>
						${event.user.firstName } ${event.user.lastName }
					</td>
				</tr>
			</c:when>
		</c:choose>
		</tr>
	</c:forEach>
		</tbody>
	</table>
	<h3 name="mini">Miniatures Events</h3>
	<table width="100%" name="mini">
		<thead>
			<th width="20%">Event Name</th>
			<th width="65%">Description</th>
			<th width="15%">Details</th>
		</thead>
		<tbody>
	<c:forEach var="event" items="${slot.events }">
		<c:choose>
			<c:when test="${event.status == 3 && event.eventType == 3}">
				<tr>
					<td style="border-bottom:1px solid #C0C0C0;">${event.eventName }</td>
					<td style="border-bottom:1px solid #C0C0C0;">${event.eventDesc }</td>
					<td style="border-bottom:1px solid #C0C0C0;font-size:10pt">
						${event.rules }<br>
						<c:choose>
							<c:when test="${event.playerExperience == 1 }">Younger Players Welcome</c:when>
							<c:when test="${event.playerExperience == 2 }">Newcomers Welcome</c:when>
							<c:when test="${event.playerExperience == 3 }">Some Gaming Experience</c:when>
							<c:when test="${event.playerExperience == 4 }">Some Experience with Specific Game</c:when>
							<c:when test="${event.playerExperience == 5 }">Regular Play of Specific Game</c:when>
							<c:when test="${event.playerExperience == 6 }">High Degree of Experience</c:when>
						</c:choose><br>
						${event.totalSeats } Players<br>
						${event.user.firstName } ${event.user.lastName }
					</td>
				</tr>
			</c:when>
		</c:choose>
		</tr>
	</c:forEach>
		</tbody>
	</table>
	<h3 name="rpg">Role Playing Events</h3>
	<table width="100%" name="rpg">
		<thead>
			<th width="20%">Event Name</th>
			<th width="65%">Description</th>
			<th width="15%">Details</th>
		</thead>
		<tbody>
	<c:forEach var="event" items="${slot.events }">
		<c:choose>
			<c:when test="${event.status == 3 && event.eventType == 4}">
				<tr>
					<td style="border-bottom:1px solid #C0C0C0;">${event.eventName }</td>
					<td style="border-bottom:1px solid #C0C0C0;">${event.eventDesc }</td>
					<td style="border-bottom:1px solid #C0C0C0;font-size:10pt">
						${event.rules }<br>
						<c:choose>
							<c:when test="${event.playerExperience == 1 }">Younger Players Welcome</c:when>
							<c:when test="${event.playerExperience == 2 }">Newcomers Welcome</c:when>
							<c:when test="${event.playerExperience == 3 }">Some Gaming Experience</c:when>
							<c:when test="${event.playerExperience == 4 }">Some Experience with Specific Game</c:when>
							<c:when test="${event.playerExperience == 5 }">Regular Play of Specific Game</c:when>
							<c:when test="${event.playerExperience == 6 }">High Degree of Experience</c:when>
						</c:choose><br>
						${event.totalSeats } Players<br>
						${event.user.firstName } ${event.user.lastName }
					</td>
				</tr>
			</c:when>
		</c:choose>
		</tr>
	</c:forEach>
		</tbody>
	</table>
	 </div>
</c:forEach>